import {createAPI, createLookFileAPI, createFormAPI, createUploadAPI, createParamsAPI} from '@/utils/http'

export const getListData = data => createFormAPI('/problem/search', 'post', data)  //题目列表
export const deleteProblemById = data => createAPI(`/problem/delete/${data.id}`, 'delete', data)  //删除题目
export const getOneById = data => createParamsAPI(`/problem/detail/${data.id}`, 'post', data)  //查看单个题目
export const saveProblem = data => createAPI(`/problem/save`, 'post', data)  //添加题目
export const updateProblem = data => createAPI(`/problem/update`, 'put', data)  //更新题目


//标签
export const getTagList = data => createAPI('/tag/list', 'post', data)  //所有标签
export const saveTag = data => createAPI('/tag/save', 'post', data)
export const updateTag = data => createAPI('/tag/update', 'put', data)
export const deleteTag = data => createAPI(`/tag/delete/${data.id}`, 'delete', data)

export const getExampleCase = data => createAPI(`/problem/case/examples/${data.id}`, 'post', data)  //题目展示的测试用例

//提交测试
export const testSubmitApi = data => createAPI('/submit/test', 'post', data)

export const submitSaveApi = data => createAPI('/submit/main', 'post', data)  //提交保存

export const getSubmitResultApi = data => createAPI(`/submit/result/${data.id}`, 'post', data)  //查询结果

export const getLastSubmit = data => createAPI(`/submit/last/${data.id}`, 'post', data)  //查询上次提交代码 Id = problemId

// case
export const getProblemCaseList = data => createAPI(`/problem/case/list/${data.id}`, 'post', data)  //查看是所有

export const saveProblemCase = data => createAPI(`/problem/case/save`, 'post', data)  //添加
export const updateProblemCase = data => createAPI(`/problem/case/update`, 'put', data)  //修改
export const deleteProblemCase = data => createAPI(`/problem/case/delete/${data.id}`, 'delete', data)  //修改

export const downLoadProblemCase = data => createLookFileAPI(`/problem/case/download`, 'post', data)  //下载case文件

export const uploadProblemCase = data => createUploadAPI(`/problem/case/upload`, 'post', data)  //上传测试数据文件

export const uploadProblem = data => createUploadAPI(`/problem/upload`, 'post', data)  //上传题目文件

export const downLoadProblem = data => createLookFileAPI(`/problem/download/${data.id}`, 'post', data)  //下载题目文件


//过题数榜单
export const getProblemRank = data => createParamsAPI(`/submit/accept/rank`,'post',data);
